package org.lex.notepad.ui.search;

import java.awt.Component;

import javax.swing.GroupLayout;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JTextField;
import javax.swing.LayoutStyle;
import javax.swing.SwingConstants;
import javax.swing.WindowConstants;

/**
 * This code was edited or generated using CloudGarden's Jigloo SWT/Swing GUI
 * Builder, which is free for non-commercial use. If Jigloo is being used
 * commercially (ie, by a corporation, company or business for any purpose
 * whatever) then you should purchase a license for each developer using Jigloo.
 * Please visit www.cloudgarden.com for details. Use of Jigloo implies
 * acceptance of these licensing terms. A COMMERCIAL LICENSE HAS NOT BEEN
 * PURCHASED FOR THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED LEGALLY FOR
 * ANY CORPORATE OR COMMERCIAL PURPOSE.
 */
public class FindPane extends javax.swing.JPanel {
	private JLabel findLabel;
	private JRadioButton matchWholeWordRadioButton;
	private JButton closeButton;
	private JCheckBox searchDownCheckBox;
	private JCheckBox searchUpCheckBox;
	private JRadioButton matchCaseRadioButton;
	private JTextField findTextField;
	private JButton findButton;

	/**
	 * Auto-generated main method to display this JPanel inside a new JFrame.
	 */
	public static void main(String[] args) {
		JFrame frame = new JFrame();
		JPanel pane = new FindPane();
		pane.validate();
		frame.setContentPane(pane);
		frame.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
		frame.pack();
		frame.setVisible(true);
	}

	public FindPane() {
		super();
		initGUI();
	}

	private void initGUI() {
		try {
			GroupLayout thisLayout = new GroupLayout((JComponent) this);
			this.setLayout(thisLayout);
			thisLayout.setVerticalGroup(thisLayout
					.createSequentialGroup()
					.addContainerGap()
					.addGroup(
							thisLayout
									.createParallelGroup(GroupLayout.Alignment.BASELINE)
									.addComponent(getFindButton(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE,
											GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
									.addComponent(getFindLabel(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE,
											GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
									.addComponent(getFindTextField(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE, 22,
											GroupLayout.PREFERRED_SIZE))
					.addPreferredGap(LayoutStyle.ComponentPlacement.RELATED)
					.addGroup(
							thisLayout
									.createParallelGroup()
									.addGroup(
											GroupLayout.Alignment.LEADING,
											thisLayout
													.createParallelGroup(GroupLayout.Alignment.BASELINE)
													.addComponent(getCloseButton(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE,
															GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
													.addComponent(getMatchWholeWordRadioButton(), GroupLayout.Alignment.BASELINE,
															GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
													.addComponent(getSearchUpCheckBox(), GroupLayout.Alignment.BASELINE, GroupLayout.PREFERRED_SIZE,
															GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE))
									.addGroup(
											thisLayout
													.createSequentialGroup()
													.addGap(20)
													.addGroup(
															thisLayout
																	.createParallelGroup(GroupLayout.Alignment.BASELINE)
																	.addComponent(getMatchCaseRadioButton(), GroupLayout.Alignment.BASELINE,
																			GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE,
																			GroupLayout.PREFERRED_SIZE)
																	.addComponent(getSearchDownCheckBox(), GroupLayout.Alignment.BASELINE,
																			GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE,
																			GroupLayout.PREFERRED_SIZE)))).addContainerGap());
			thisLayout.setHorizontalGroup(thisLayout
					.createSequentialGroup()
					.addContainerGap()
					.addComponent(getFindLabel(), GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)
					.addGap(12)
					.addGroup(
							thisLayout
									.createParallelGroup()
									.addGroup(
											thisLayout
													.createSequentialGroup()
													.addGroup(
															thisLayout
																	.createParallelGroup()
																	.addComponent(getMatchCaseRadioButton(), GroupLayout.Alignment.LEADING,
																			GroupLayout.PREFERRED_SIZE, 105, GroupLayout.PREFERRED_SIZE)
																	.addComponent(getMatchWholeWordRadioButton(), GroupLayout.Alignment.LEADING,
																			GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE,
																			GroupLayout.PREFERRED_SIZE))
													.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
													.addGroup(
															thisLayout
																	.createParallelGroup()
																	.addComponent(getSearchDownCheckBox(), GroupLayout.Alignment.LEADING,
																			GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE,
																			GroupLayout.PREFERRED_SIZE)
																	.addComponent(getSearchUpCheckBox(), GroupLayout.Alignment.LEADING,
																			GroupLayout.PREFERRED_SIZE, 80, GroupLayout.PREFERRED_SIZE)))
									.addComponent(getFindTextField(), GroupLayout.Alignment.LEADING, 0, 196, Short.MAX_VALUE))
					.addPreferredGap(LayoutStyle.ComponentPlacement.UNRELATED)
					.addGroup(
							thisLayout
									.createParallelGroup()
									.addComponent(getCloseButton(), GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE, 57,
											GroupLayout.PREFERRED_SIZE)
									.addComponent(getFindButton(), GroupLayout.Alignment.LEADING, GroupLayout.PREFERRED_SIZE,
											GroupLayout.PREFERRED_SIZE, GroupLayout.PREFERRED_SIZE)).addContainerGap());
			thisLayout.linkSize(SwingConstants.HORIZONTAL, new Component[] { getSearchUpCheckBox(), getSearchDownCheckBox() });
			thisLayout.linkSize(SwingConstants.HORIZONTAL, new Component[] { getMatchWholeWordRadioButton(), getMatchCaseRadioButton() });
			thisLayout.linkSize(SwingConstants.HORIZONTAL, new Component[] { getFindButton(), getCloseButton() });
			this.setPreferredSize(new java.awt.Dimension(348, 88));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}

	private JLabel getFindLabel() {
		if (findLabel == null) {
			findLabel = new JLabel();
			findLabel.setText("Find what:");
		}
		return findLabel;
	}

	private JButton getFindButton() {
		if (findButton == null) {
			findButton = new JButton();
			findButton.setText("Find next");
		}
		return findButton;
	}

	private JTextField getFindTextField() {
		if (findTextField == null) {
			findTextField = new JTextField();
		}
		return findTextField;
	}

	private JRadioButton getMatchWholeWordRadioButton() {
		if (matchWholeWordRadioButton == null) {
			matchWholeWordRadioButton = new JRadioButton();
			matchWholeWordRadioButton.setText("Match whole word");
		}
		return matchWholeWordRadioButton;
	}

	private JRadioButton getMatchCaseRadioButton() {
		if (matchCaseRadioButton == null) {
			matchCaseRadioButton = new JRadioButton();
			matchCaseRadioButton.setText("Match case");
		}
		return matchCaseRadioButton;
	}

	private JCheckBox getSearchUpCheckBox() {
		if (searchUpCheckBox == null) {
			searchUpCheckBox = new JCheckBox();
			searchUpCheckBox.setText("Search up");
		}
		return searchUpCheckBox;
	}

	private JCheckBox getSearchDownCheckBox() {
		if (searchDownCheckBox == null) {
			searchDownCheckBox = new JCheckBox();
			searchDownCheckBox.setText("Search down");
		}
		return searchDownCheckBox;
	}

	private JButton getCloseButton() {
		if (closeButton == null) {
			closeButton = new JButton();
			closeButton.setText("Close");
		}
		return closeButton;
	}
}
